home *** CD-ROM | disk | FTP | other *** search
- <SCRIPT type="text/javascript" LANGUAGE="JavaScript">
-
- var wholedate; var wholedatestring; var mo; var day; var yr; var d;
-
- var gotEm = false;
- var todayDate = myDate.getDate(); // day number 1-31
- var todayDay = myDate.getDay(); // day of week 1-7
- var todayTime = myDate.getTime(); // milliseonds!!
- var oneDay = 86400000; // # of milliseconds in one day
- var mostRecent = todayTime; //stores most recent distribution date in milliseconds
-
- //find the nearest wednesday distribution date
- if (todayDay<3) { mostRecent = todayTime-((4+todayDay)*oneDay) } // readjust mostRecent
- else if (todayDay>3) { mostRecent = todayTime-((todayDay-3)*oneDay) } // readjust mostRecent
-
- //traverse the list and make comparisons!
- for (var i=0 ; i<=cm_dc_itemStoredate.length-1 ; i++) {
- d = new Date();
- wholedate = cm_dc_itemStoredate[i].split(" ");
- mo = wholedate[0];
- day = wholedate[1].substring(0,wholedate[1].length-3);
- yr = wholedate[2];
- wholedatestring = (mo + ", " + day + " " + yr);
- d.setTime(Date.parse(wholedatestring));
- testtime = d.getTime();
- if ( (testtime>mostRecent-oneDay) && (testtime<mostRecent+oneDay) ) { //ok, we've got it!
- document.write(" » <a href=\"dc_display.html?cm_dc_itemCode=" + cm_dc_itemCode[i] + "&month=" + month + "\">");
- document.write(cm_dc_itemTitle[i] + "</a><br>");
- }
- else if (gotEm==true) {break;}
- }
- </script>
-